import { message } from 'antd'
export const showMessage = (status: number | string) => {
    let messageText: string = ''
    switch (status) {
        case 400:
            messageText = '请求错误(400)'
            break
        case 401:
            localStorage.removeItem('token')
            window.location.href = '/401'
            break
        case 403:
            messageText = '拒绝访问(403)'
            break
        case 404:
            messageText = '网络请求不存在(404)'
            break
        case 408:
            messageText = '请求超时(408)'
            break
        case 500:
            messageText = '服务器错误(500)'
            break
        case 501:
            messageText = '服务未实现(501)'
            break
        case 502:
            messageText = '网络错误(502)'
            break
        case 503:
            messageText = '服务不可用(503)'
            break
        case 504:
            messageText = '网络超时(504)'
            break
        case 505:
            messageText = 'HTTP版本不受支持(505)'
            break
        default:
            messageText = `连接出错(${status})!`
    }
    message.error(messageText)
}
